package
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.KeyboardEvent;
	import flash.sampler.NewObjectSample;
	import flash.ui.Keyboard;
	import flash.ui.KeyboardType;
	
	import pew.wav;
	
	public class Tank extends MovieClip
	{
		var myBullet:bullet = new bullet();
		public var vx:int;
		public var bulletArray:Array = new Array();
		var mySound:wav = new wav();
		public function Tank()
		{
			super();
			this.addEventListener(Event.ENTER_FRAME, update);
			//stage.addEventListener(KeyboardEvent.KEY_DOWN,keyboard_Handler);
		}
		
		public function fire():void
		{
			if(myBullet.stage)
			{}
			else {
			//stage.removeChild(myBullet)
			myBullet.x = this.x;
			myBullet.y = this.y-29;
			stage.addChild(myBullet);
			mySound.play();
			}
		}
		public function update(e:Event):void
		{
			//used to only require one event listener.
			
			move();
			if(myBullet.y <0 && myBullet.stage)
			{
				stage.removeChild(myBullet);
			}
			
		}
		
		
		public function move():void
		{
			
			this.x+=vx;
		}
		
	}
}